package com.lagou.mr.homework1;

import org.apache.hadoop.io.IntWritable;
import org.apache.hadoop.io.LongWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Mapper;
import org.apache.hadoop.yarn.webapp.hamlet.Hamlet;

import java.io.IOException;

public class HomeworkMapper extends Mapper<LongWritable, Text, IntWritable,IntWritable> {
    private IntWritable mappervalue = new IntWritable();

    @Override
    protected void map(LongWritable key, Text value, Mapper<LongWritable, Text, IntWritable, IntWritable>.Context context) throws IOException, InterruptedException {
        final String num = value.toString().trim();
        mappervalue.set(Integer.parseInt(num));
        context.write(mappervalue,new IntWritable(1));
    }
}
